﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CinemaSystem
{
    public partial class FormXGMM : Form
    {
        public FormXGMM()
        {
            InitializeComponent();
        }
        string sqlstr;
       
        private void FormXGMM_Load(object sender, EventArgs e)
        {

        }
        public static string yuan=DengluForm.yuan;
        public static int hao=DengluForm.hao;
           
        private void button1_Click(object sender, EventArgs e)
        {
            sqlstr = string.Empty;
            if (textBox1.Text!=""||textBox2.Text!="" || textBox3.Text != "")
            {
                if (textBox2.Text==yuan)
                {
                    if (textBox1.Text==textBox3.Text)
                    {
                        sqlstr = string.Format("update [User] set Userpwd='{0}'where Userid='{1}'",textBox3.Text,hao);
                        int i = DBHelper.ExecuteNonQuery(sqlstr);
                        if (i>0)
                        {
                            MessageBox.Show("修改成功，请重新登录");
                            DengluForm dengluForm = new DengluForm();
                            dengluForm.Show();
                            this.Hide();
                            
                        }
                    }
                    else
                    {
                        MessageBox.Show("两次输入的密码不一致");
                    }
                }
                else
                {
                    MessageBox.Show("原密码错误");
                }
            }
            else
            {
                MessageBox.Show("信息不能为空");
            }
        }

      
    }
}
